
<script>
    function import_check(){
        var f_content = form1.file.value;
        var filetext=f_content.substring(f_content.lastIndexOf("."),f_content.length)
        filetext=filetext.toLowerCase()
        if (filetext!='.xls')
        {
            alert("Sorry,wrong file type.Please try again!");
            return false;
        }
        else
        {
           alert("Now upload your file!");
        }

    }
</script>

<table width="98%" border="0" align="center" style="margin-top:20px; border:1px solid #9abcde;">
    <form id="form1" name="form1" enctype="multipart/form-data" method="post" action="upload" >

        <tr >
            <td height="28" colspan="2" align="center"><label><strong>Import ExcelSheet into Database</strong></label></td>
        </tr>
        <tr><td>Table Name</td><td><input type="text"id="dbtable" name="dbtable" /></td></tr>
       <!--  <tr><td>Column Name<br/><font size="-1" style=" font-style:oblique">type the column you want to import data in, separate with";"</font></td><td><textarea rows="3" cols="50" id="fieldslect" name="fieldslect"></textarea></td></tr> -->
        <tr>
            <td width="18%" height="50"> Select File:</td>
            <td width="82%"><label>
                <?php echo $this->Form->file('csv'); ?>
            </label>
                <label>

                </label>
            </td>
        </tr>
        <tr >
            <td height="28" colspan="2" align="center"><input name="button" type="submit" class="nnt_submit" id="button" value="Import" style= "width:160px;height=40px;" onclick="import_check();"/> </td></tr>
        <tr ><td height="28" colspan="2" align="center" bgcolor="#FFCC99"><br /><strong>Attention</strong><br />1.The file must be xls file!&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/>2.the column in the xls file must be same with the column name in the database table.</td></tr>
    </form>
</table>